/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package br.com.trumah.model;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;

import br.com.trumah.model.enums.TipoStatusDoacao;

/**
 *
 * @author rafaell
 */
@Entity
@Table(name = "Doacao")
@NamedQueries({@NamedQuery(name = "Doacao.findAll", query = "SELECT d FROM Doacao d"), @NamedQuery(name = "Doacao.findById", query = "SELECT d FROM Doacao d WHERE d.id = :id"), @NamedQuery(name = "Doacao.findByQuantidade", query = "SELECT d FROM Doacao d WHERE d.quantidade = :quantidade"), @NamedQuery(name = "Doacao.findByStatusDoacao", query = "SELECT d FROM Doacao d WHERE d.statusDoacao = :statusDoacao")})
public class Doacao implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id")
    private Long id;
    @Column(name = "quantidade")
    private Integer quantidade;
    @Column(name = "status_doacao")
    @Enumerated(EnumType.STRING)
    private TipoStatusDoacao statusDoacao;
    @JoinColumn(name = "beneficio_id", referencedColumnName = "id")
    @ManyToOne
    private Beneficio beneficioId;
    @JoinColumn(name = "beneficiario_id", referencedColumnName = "id")
    @ManyToOne
    private Beneficiario beneficiarioId;

    public Doacao() {
    }

    public Doacao(Long id) {
        this.id = id;
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public Integer getQuantidade() {
        return quantidade;
    }

    public void setQuantidade(Integer quantidade) {
        this.quantidade = quantidade;
    }

    public TipoStatusDoacao getStatusDoacao() {
        return statusDoacao;
    }

    public void setStatusDoacao(TipoStatusDoacao statusDoacao) {
        this.statusDoacao = statusDoacao;
    }

    public Beneficio getBeneficioId() {
        return beneficioId;
    }

    public void setBeneficioId(Beneficio beneficioId) {
        this.beneficioId = beneficioId;
    }

    public Beneficiario getBeneficiarioId() {
        return beneficiarioId;
    }

    public void setBeneficiarioId(Beneficiario beneficiarioId) {
        this.beneficiarioId = beneficiarioId;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Doacao)) {
            return false;
        }
        Doacao other = (Doacao) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "trumah.Doacao[id=" + id + "]";
    }

}
